package com.example.app.createmodel.singlemodel;

import lombok.Data;

@Data
public final class Person2 {
	private String name;
	private static volatile Person2 person=null;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	//私有化构造方法
	private Person2() {

	}
	
	//提供静态方法
	public static Person2 getPerson() {
		if(person == null) {
			person = new Person2();
		}
		return person;
	}
}
